# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=py3-pyfakefs
_pkgname=${pkgname#py3-}
pkgver=5.3.2
pkgrel=0
pkgdesc="fake file system that mocks the Python file system modules"
url="https://github.com/pytest-dev/pyfakefs/"
arch="noarch"
license="Apache-2.0"
depends="python3"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

case "$CARCH" in
# fails on builder currently
aarch64|armhf|armv7) _test_filter='not test_chown_follow_symlink and not test_chown_no_follow_symlink' ;;
esac

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest \
		-k "$_test_filter"
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
	rm -r "$pkgdir"/usr/lib/python*/site-packages/pyfakefs/*tests
}

sha512sums="
200dfd756c5c73dffed28ce5e20da4941f13c473fd300740a8f13a9de91ec9f2946f570413ea43de444fb9150cf875a29460e1ad791aaab09541b31f7c170785  pyfakefs-5.3.2.tar.gz
"
